feat(window): expose WindowConfig::app_id() and consume launcher activation tokens - #1085
Open
iam2r wants to merge 2 commits into
Open
feat(window): expose WindowConfig::app_id() and consume launcher activation tokens#1085iam2r wants to merge 2 commits into
iam2r wants to merge 2 commits into
Conversation
Allow applications to declare their desktop identity (Wayland app_id / X11 WM_CLASS class and instance). Desktop environments use it to associate windows with the application's .desktop entry: dock/taskbar icons, app grouping and launch tracking. When unset, behaviour is unchanged: no set_app_id() is sent on Wayland, and X11 falls back to deriving WM_CLASS from the executable name.
If the process was spawned by a desktop launcher, XDG_ACTIVATION_TOKEN (Wayland) or DESKTOP_STARTUP_ID (X11) identifies the pending launch created for it. Passing that token to the window makes the compositor complete the startup sequence as soon as the first surface maps. Without this, shells keep applications launched from an app grid in a "starting" state until a timeout expires (~15s in GNOME), delaying the dock/taskbar entry and proper focus.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Applications built with Floem currently never identify their windows to the
desktop environment:
No application name is requested.
create_windowbuilds winit'sWindowAttributeswithout ever setting a name, so winit never callsset_app_id()on Wayland. On X11 the backend silently falls back toderiving
WM_CLASSfromargv[0], masking the issue.Result on GNOME Wayland: the window cannot be associated with any
.desktopentry — taskbars/docks show a generic icon or an "UNKNOWN"label, windows don't group, and launch tracking degrades
(see Lapce is missing icon in a lot of places for Gnome/Wayland lapce#2199).
Launcher activation tokens are never consumed. When a desktop shell
launches an app it passes
XDG_ACTIVATION_TOKEN(Wayland) /DESKTOP_STARTUP_ID(X11) and keeps the launch in a pending state untilthe token is used. Unconsumed, shells fall back to a timeout (~15s on
GNOME), during which the dock shows a launching animation instead of the
app entry.
Protocol capture of an affected app confirms no
set_app_idis ever sent:Change
This PR adds two small, opt-in capabilities to window creation:
WindowConfig::app_id(impl Into<String>)— declares the applicationidentity. When set, floem applies it via winit's
WindowAttributesExtWayland::with_name()/WindowAttributesExtX11::with_name()(Wayland
app_id, X11WM_CLASS). When unset, behaviour is exactly asbefore.
launcher, the token reported by
EventLoopExtStartupNotify::read_token_from_env()is attached withWindowAttributesExtStartupNotify::with_activation_token(), letting thecompositor complete the startup sequence immediately.
Both are
#[cfg(target_os = "linux")]; other platforms are untouched.Why
lapce-backportsLapce pins this branch, so this is where the fix can reach the editor's next
release. I'm happy to port it to
mainas well once this lands or once thedirection is confirmed (main's new window-creation layout needs a slightly
different patch shape due to the
winit-coresplit).Testing
~15s.
WAYLAND_DEBUG=1) now showsxdg_toplevel.set_app_id("dev.lapce.lapce")before the surface maps.shell side). Happy to add builder-level tests if preferred.